package com.lightsaber.trade.cloth.tools;

import org.mortbay.jetty.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springside.modules.test.utils.JettyUtils;

/**
 * 使用Jetty运行调试Web应用, 在Console输入回车停止服务.
 * 
 * @author calvin
 */
public class Start {

    private final static Logger log = LoggerFactory.getLogger(Start.class);

    public static final int PORT = 7890;
    public static final String CONTEXT = "/hpp";
    public static final String BASE_URL = "http://localhost:7890/hpp";

    public static void main(final String[] args) throws Exception {
        Server server = JettyUtils.buildNormalServer(PORT, CONTEXT);
        server.start();

        log.info("Hit Enter in console to stop server");
        if (System.in.read() != 0) {
            server.stop();
            log.info("Server stopped");
        }
    }
}
